{% extends 'base.html' %}
{% load static %}
{% block title %}用例执行结果{% endblock %}
{% block content %}
<div class="table-responsive">
    <table class="table table-striped">
        <thead>
        <tr>
            <th width="4%">id</th>
            <th width="4%">名称</th>
            <th width="20%">请求数据</th>
            <th width="20%">执行返回结果</th>
            <th width="5%">操作</th>
            <th>断言内容</th>
            <th width="5%">执行结果</th>
            <th width="5%">异常信息</th>
            <th width="10%">请求后提取变量</th>
            <th width="8%">开始时间</th>
            <th width="8%">执行耗时(ms)</th>
        </tr>
        </thead>
        {% for testrecord in test_case_execute_records %}
        <tr>
            <td>{{ testrecord.id }}</td>
            <td><a href="{% url 'test_case_detail'  testrecord.belong_test_case_id%}" target="_blank"></a>{{ testrecord.belong_test_case.case_name }}</td>
            <td>{{ testrecord.request_data }}</td>
            <td>{{ testrecord.response_data }}</td>
            <td><a href="{% url 'case_result_diff' testrecord.id%}" target="_blank">对比差异</a></td>
            <td>{{ testrecord.belong_test_case.assert_key}}</td>
            <td>{{ testrecord.execute_result|default_if_none:"" }}</td>
            {% if testrecord.exception_info %}
            <td><a href="{% url 'show_exception' testrecord.id%}" target="_blank">显示异常信息</a></td>
            {% else %}
            <td>无</td>
            {% endif %}
            <td>{{ testrecord.extract_var}}</td>
            <td>{{ testrecord.execute_start_time }}</td>
            <td>{{ testrecord.execute.total_time }}</td>
        </tr>
    {% endfor %}
    </table>
</div>
<div id="pages" class="text-center">
    <nav>
        <ul class="pagination">
            <li class="step-links">
                {% if test_case_execute_records.has_previous %}
                <a class="active" href="?page={{ test_case_execute_records.previous_page_number }}"></a>
                {% endif %}
            <span class="current">第 {{ test_case_execute_records.number }} 页 / 共 {{ test_case_execute_records.paginator.num_pages }}</span>
            {% if test_case_execute_records.has_next %}
                <a class="active" href="?page={{ test_case_execute_records.next_page_number}}">下一页</a>
            {% endif %}
        </ul>
    </nav>
</div>
{% endblock %}